
<template>
  <el-form>
    <el-form-item :label-width="formLabelWidth" label="是否同意：">
      <el-select v-model="sendFlag" placeholder="请选择">
        <el-option label="同意" value="1"></el-option>
        <el-option label="不同意" value="0"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label-width="120px" label="备注：">
      <el-input width="100%" type="textarea" v-model="taskComment"></el-input>
    </el-form-item>
    <el-form-item class="btnDir">
      <el-button @click="onSubmit">确 定</el-button>
      <el-button @click="onCancel">取 消</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import requestUtil from "@/utils/requestEnc";
import CustOrderService from "@/api/order/CustOrderService";
import { mapState } from "vuex";
export default {
  components: {
    requestUtil,
    CustOrderService,
  },
  computed: {
    ...mapState("orders", ["orderItemList"]),
    ...mapState("user", ["user"]),
  },
  async mounted() {},
  watch: {},
  props: {
    ODKInfo: {
      type: Object,
      default: () => {
        return {};
      },
    },
    CTOInfo: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  data() {
    return {
      formLabelWidth: "120px",

      reFee: "",
      valueRadio: "",
      orderTask: {},
      taskComment: "",
      sendFlag: "",
    };
  },
  methods: {
    onCancel() {
      this.$emit("update:show", false);
    },
    async onSubmit() {
      if (this.CTOInfo.length > 0) {
        var orderItemIds = "";
        for (var i = 0; i < this.CTOInfo.length; i++) {
          if (i == 0) {
            orderItemIds += this.CTOInfo[i].orderItemId;
          } else {
            orderItemIds += "," + this.CTOInfo[i].orderItemId;
          }
        }
        this.orderItemIds = orderItemIds;

        var requestObject = {
          orderItemIds: this.orderItemIds,
          taskComment: this.taskComment,
          userId: "__STAFF_ID__",
          custId: this.CTOInfo[0].custId,
          orderAuditId: this.CTOInfo[0].orderAuditId,
          sendFlag: this.sendFlag,
        };

        
        var result = await CustOrderService.pauseRentConfirm(requestObject);

        
        if (result.meta && result.meta.resultCode == "0") {
          this.$confirm("暂停起租成功", "提示", {
            confirmButtonText: "确定",
            showCancelButton: false,
            type: "success",
            center: true,
          });
          this.$emit("close");
        } else {
          this.$confirm(result.meta, "提示", {
            confirmButtonText: "确定",
            showCancelButton: false,
            type: "warn",
            center: true,
          });
        }
      }
    },
  },
};
</script>

<style>
.el-form--inline .el-form-item {
  display: inline-flex;
  margin-right: 0.1rem;
  vertical-align: top;
  width: 42%;
}

.el-form-item__label {
  width: 94px;
}
.btnDir {
  margin-left: 36%;
  margin-top: 19px;
}
</style>